<template>
  <div class='container'>
    <el-dialog title="预览文章" :visible.sync="showDialog" width="800px">
      <h2>{{previewData.title}}</h2>
      <span>{{previewData.createTime}}</span>
      <span>{{previewData.username}}</span>
      <el-button disabled type='text' size='mini' icon="el-icon-view"></el-button>
      <span>{{previewData.visits}}</span>
      <div v-html="previewData.articleBody" class="content"></div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    previewData: {
      type: Object,
      required: true
    }
  },
  data: function () {
    return {
      showDialog: false
    }
  },
  methods: {
    // 显示对话框
    handleShow () {
      this.showDialog = true
    }
  }
}
</script>

<style scoped lang='less'>
span {
  margin: 0 5px;
}
h2 {
  margin: 0 5px;
}
.content {
  padding: 0 10px;
  width: 100%;
  height: 100%;
  border-top: 1px dotted #000;
  background-color: #f5f5f5;
  color: #606266;
}
</style>
